#ifndef _LJDEF_H_
#define _LJDEF_H_

#define BUFFSIZE 1024
struct data_buf {
    int fd;
    char buff[BUFFSIZE];
};

#ifdef __cplusplus
extern "C" {
#endif

int buffer_to_string(char* dest, int width, const struct data_buf* buf);

#include <stdio.h>
#define BUFFER_TO_STRING(dest, width, buf) \
    snprintf((dest), (width), "ptr=%p, fd=%d, buff=%.*s", (buf), (buf)->fd, BUFFSIZE, (buf)->buff)

#ifdef __cplusplus
}
#endif

#endif